<template>
	<view class="ys">
		<view class="list">
			<view class="item" v-for="(item,index) in list" :key="index" v-if="list.length!=0">
				<view class="title">
					{{item.shop_name}}
				</view>
				<view class="infobox">
					<view class="left">
						<view class="li">
							昨日销售：{{item.YesterdayMoney}} 元
						</view>
						<view class="li">
							今日销售：{{item.TodayMoney}} 元
						</view>
						<view class="li">
							本月销售：{{item.MoneyMonth}} 元
						</view>
						<view class="li">
							上月销售：{{item.LastMoney}} 元
						</view>
						<view class="li">
							总销售：{{item.MoneyAll}} 元
						</view>
						<view class="li">
							利润总额：{{item.reward_money}} 元
						</view>
					</view>
					<view class="right">
						<button @click="toPage('./member?id='+item.id)">查看店成员</button>
						<button @click="toPage('./order?id='+item.id)">查看订单</button>
					</view>
				</view>
			</view>
			<view class="no-list" v-else>
				- 暂无数据 -
			</view>

		</view>
	</view>
</template>

<script>
	import {
		Com
	} from "@/api/shop.js"
	export default {
		data() {
			return {
				last_page: 1,
				page: 1,
				list: [],
				link: '',
				info: []
			}
		},

		onLoad() {
			this.Com()
		},
		onReachBottom() {
			if (this.page < this.last_page) {
				this.page++
				this.Com()
			}
		},
		methods: {
			saveImg() {
				var that = this
				that.$refs.uqrcode.save({
					success: res => {}
				});

			},
			Com() {
				Com({
					page: this.page
				}).then(res => {
					if (res.status == 1) {
						this.list = this.list.concat(res.data.data)
						this.last_page = res.data.last_page
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.codebox {
		background: #00000080;
		width: 100vw;
		height: 100vh;
		display: flex;
		align-items: center;
		justify-content: center;
		position: fixed;
		top: 0;
		left: 0;

		.code {
			background: #fff;
			border-radius: 8px;
			padding: 20px;
		}

		button {
			font-size: 14px;
			margin-top: 20px;
			background: #FF3C29;
			color: #fff;
		}
	}

	.list {
		padding: 10px;

		.item {
			background: #fff;
			border-radius: 5px;
			padding: 10px;
			margin-bottom: 10px;

			.title {
				font-weight: bold;
				font-size: 16px;
				padding-bottom: 10px;
				border-bottom: 1px solid #eee;
				margin-bottom: 5px;
			}

			.infobox {
				display: flex;
				align-items: center;
				justify-content: space-between;
			}

			.li {
				font-size: 14px;
				margin: 5px 0;
			}

			.right {
				display: flex;
				flex-direction: column;
				font-size: 12px;
				color: #777;

				image {
					width: 60px;
				}

				button {
					font-size: 14px;
					background: #E1ECFE;
					color: #6b7490;
					width: 100px;
					margin: 5px 0;
				}
			}
		}
	}
</style>